//
//  MainViewController.m
//  DualSnake
//
//  Created by HacJune Lee on 13. 12. 6..
//  Copyright (c) 2013년 HakJune Lee. All rights reserved.
//

#import "MainViewController.h"


@interface MainViewController ()

@end

@implementation MainViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    GamePad * pad = [[[NSBundle mainBundle]loadNibNamed:@"GamePad" owner:self options:nil] objectAtIndex:0];
    pad.delegate = self;
    [pad setFrame:CGRectMake(60, 450, 200, 100)];
    [self.view addSubview:pad];
    
    [GameMaster shared].delegate = self;
    [[GameMaster shared] setTimer];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)inputDirection:(int)direction
{
    [[GameMaster shared]setPlayer1_nextDirection:direction];
}

-(void)playTimeTic:(int)playTime
{
    _playTimeLabel.text = [NSString stringWithFormat:@"%d", playTime];
}

-(void)createItem:(int)itemType
{
    [_gamePlateView createItem:itemType];
}
@end
